<!DOCTYPE html>
<html>
<head>
<#include "/admin/common/common.ftl" parse=true encoding="utf-8">
<link href="${base}/scripts/ckeditor/skins/moono/editor.css" type="text/css" rel="stylesheet">
</head>
<body class="hold-transition skin-blue sidebar-mini">
	<div class="wrapper">

		<#include "/admin/common/header.ftl" parse=true encoding="utf-8">

		<!-- Content Wrapper. Contains page content -->
		<div class="content-wrapper">
			<!-- Content Header (Page header) -->
			<section class="content-header">
				<h1>课程管理</h1>
				<ol class="breadcrumb">
					<li class="active">添加新节</li>
				</ol>
			</section>

			<!-- Main content -->
			<section class="content">
				<!-- Info boxes -->
				<div class="row">
					<div class="box">
						<div class="box-header">
							<div class="table-btn">
								<a href="${base}/admin/course/${course.id! }/chapter/${chapter.id! }/lesson/list.do">
									<span class="label label-primary">列表</span>
								</a>
							</div>
						</div>
						<!-- /.box-header -->
						<div class="box-body">
						<form class="form-horizontal" id="defaultForm" method="post" action="${base}/admin/course/${course.id!}/chapter/${chapter.id!}/lesson/addnewAction.do" enctype="multipart/form-data">
								<div class="form-group">
									<label class="col-md-2 control-label">课程名称</label>
									<div class="col-md-8">
										<input class="form-control" type="text" rows="10"  disabled="disabled" value="${course.name!}">
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-2 control-label">章名称</label>
									<div class="col-md-8">
										<input  class="form-control" type="text" rows="10"  disabled="disabled" value="${chapter.name!}">
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-2 control-label">节名称</label>
									<div class="col-md-8">
										<input id="name" name="name" class="form-control" type="text" rows="10" placeholder="请输入课程名称">
									</div>
								</div>
								<div class="form-group">
									<label class="col-md-2 control-label">节视频</label>
									<div class="col-md-8">
										<input id="coursewareUrlFile" name="files"  type="file"  />
									</div>
								</div>
								<div class="form-group">
									<div class="col-sm-offset-3 col-sm-3">
										<button type="submit" class="btn btn-primary">添加</button>
										<input type="button" class="btn btn-primary"   onclick="returnLessonList('${course.id!}', '${chapter.id! }')" value="返回">
									</div>
								</div>
							</form>
						</div>
						<!-- /.box-body -->
					</div>
					<!-- /.box -->
				</div>
				<!-- /.row -->
			</section>
			<!-- /.content -->
		</div>
		<!-- /.content-wrapper -->

	</div>
	<!-- ./wrapper -->
	<#include "/admin/common/footer.ftl" parse=true encoding="utf-8">
</body>
<script type="text/javascript">

	function returnLessonList(courseId, chapterId){
		window.location.href = "${base}/admin/course/"+courseId+"/chapter/"+chapterId+"/lesson/list.do";
	}

	$('#defaultForm').bootstrapValidator({
		message : '该项不能为空',
		live : 'disabled',
		feedbackIcons : {
			valid : 'glyphicon glyphicon-ok',
			invalid : 'glyphicon glyphicon-remove',
			validating : 'glyphicon glyphicon-refresh'
		},
		submitHandler : function(validator, form, submitButton) {
			if (window.confirm("确定要添加该节？")) {
				validator.defaultSubmit();
			} else {
				return;
			}

		},
		fields : {
			name : {
				validators : {
					notEmpty : {
						message : '章名称不能为空'
					}
				}
			}
		}
	});
</script>
</html>
